package com.mall.service.Impl;


import com.mall.service.SendMailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Service;

@Service
public class SendMailServiceImpl implements SendMailService {
    @Autowired
    private JavaMailSender javaMailSender;
    // 发送人
    private String from = "2575603138@qq.com";

    @Override
    public void sendMailForErrorMessage(String errorMessage) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom(from);
        message.setTo("2575603138@qq.com");
        message.setSubject("错误信息");
        message.setText(errorMessage);
        javaMailSender.send(message);
    }
}
